package com.yunhe.common.constant;

/**
 * 量测常量定义
 * @author liuronglei
 */
public class MeasurementConsts {

    // 数据标记定义
    public enum FLAG {
        Normal(0, "正常"),
        Disconnect(1, "掉线"),
        Connect(2, "重连");
        private Integer value;
        private String title;
        FLAG(Integer value, String title) {
            this.value = value;
            this.title = title;
        }
        public Integer value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    // 时间频率定义
    public enum FREQUENCY {
        Original("original", "原始值"),
        Minute15("15m", "15分钟"),
        Hour("1h", "1小时"),
        Day("1d", "1天");
        private String value;
        private String title;
        FREQUENCY(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(String value) {
            return this.value().equals(value);
        }
    }

    // 开关状态值定义
    public enum BREAKER_STATUS {
        Opened(0d, "断开"),
        Closed(1d, "闭合");
        private Double value;
        private String title;
        BREAKER_STATUS(Double value, String title) {
            this.value = value;
            this.title = title;
        }
        public Double value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(Double value) {
            return this.value().equals(value);
        }
    }

    // 运行状态值定义
    public enum WORK_STATUS {
        OffLine(0d, "离网"),
        Running(1d, "运行中"),
        Charging(2d, "充电中"),
        Discharging(3d, "放电中"),
        Storage(4d, "蓄电中"),
        Generating(5d, "发电中"),
        Standby(6d, "待机"),
        Inactive(7d, "停机中"),
        Overhauling(8d, "检修中"),
        Debugging(9d, "调试中"),
        Faulty(10d, "故障");
        private Double value;
        private String title;
        WORK_STATUS(Double value, String title) {
            this.value = value;
            this.title = title;
        }
        public Double value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(Double value) {
            return this.value().equals(value);
        }
    }

    // 并网状态
    public enum GRID_CONNECT_STATUS {
//        ON_GRID("OnGrid", "并网运行"),
//        OFF_GRID("OffGrid", "孤网运行"),
//        OFFING("Offing", "并网转孤网"),
//        ONING("Oning", "孤网转并网");
        ON_GRID(0d, "并网运行"),
        OFF_GRID(1d, "孤网运行"),
        OFFING(2d, "并网转孤网"),
        ONING(3d, "孤网转并网");
        private final Double value;
        private final String title;
        GRID_CONNECT_STATUS(Double value, String title) {
            this.value = value;
            this.title = title;
        }
        public Double value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(Double value) {
            return this.value().equals(value);
        }
    }

    // 异常状态值定义（主要用于定义是否发生告警）
    public enum ALARM_STATUS {
        Normal(0d, "正常"),
        Alarm(1d, "异常");
        private Double value;
        private String title;
        ALARM_STATUS(Double value, String title) {
            this.value = value;
            this.title = title;
        }
        public Double value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(Double value) {
            return this.value().equals(value);
        }
    }

    // 功率变化限制（目前用于判断运行状态）
    public static final Double ChangePowerBound = 1d;
}
